﻿<UserControl
    x:Class="Antares.VIEWs.TaskItemView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Antares.VIEWs"
    xmlns:vm="using:Antares.VIEWMODELs"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Converters="using:Antares.Converters"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400" 
    Tapped="UserControl_Tapped_1"
    Loaded="UserControl_Loaded_1">
    
    <UserControl.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="Foreground" Value="Black"/>
        </Style>
        <Converters:IntToShortTimeConverter x:Key="IntToShortTimeConverter"/>
        <Converters:CategoryToImageConverter x:Key="CategoryToImageConverter"/>
    </UserControl.Resources>
    
    <Grid Height="300">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Vertical"
                    x:Name="DesArea"
                    Grid.Row="0"
                    PointerEntered="StackPanel_PointerEntered_1">
            <TextBlock x:Name="TaskTitle"
                       FontWeight="Bold" 
                       Text ="{Binding DataModel.Name}"
                       TextTrimming="WordEllipsis"/>
            <TextBlock x:Name="Descrip"
                   Text ="{Binding DataModel.Description}"
                       TextTrimming="WordEllipsis"/>
            <TextBlock x:Name="TimeO"
                   Text ="{Binding DataModel.StartTime, Converter={StaticResource IntToShortTimeConverter}}"/>
        </StackPanel>
        <Rectangle Fill="#494949"
                   Width="1"
                   Grid.Row="2"
                   Grid.RowSpan="2"
                   HorizontalAlignment="Center"/>
        <Image x:Name="ItemImage"
               PointerPressed="ItemImage_PointerPressed_1"
               PointerReleased="ItemImage_OnPointerReleased"
               Source="{Binding DataModel.Category, Converter={StaticResource CategoryToImageConverter}}"
               Grid.Row="1"
               Grid.RowSpan="2"/>
    </Grid>
</UserControl>
